<?php
namespace app\admin\controller;
use app\admin\model\Base;
use think\Controller;
use think\Db;
class Goodsmsg extends Common{
    //构造方法查询数据库信息
    public function _initialize(){
        parent::_initialize();
        $db=new Base();
        $goodsmsg=$db->sel('goodsmsg');
        $this->assign('goodsmsg',$goodsmsg);
   }

   public function show(){
       return $this->fetch('show');
   }
    //调用model伪删除方法
    public function dels(){
        $id=isset($_POST['id'])?$_POST['id']:"";
        $data = ['deleted' => 1];
        $del=new Base();
        $del=$del->status('goodsmsg',$id,$data);
        return json_encode($id);
    }
    //根据用户名或商品名查询留言信息
    public function query_msg(){
       $user_id=isset($_POST['user_id'])?$_POST['user_id']:"";
       $goods_id=isset($_POST['goods_id'])?$_POST['goods_id']:"";
       $id=new \app\admin\model\Goodsmsg();
        $search_id= $id->query_msg($user_id,$goods_id);
        return $search_id;

    }

}